<?php

class QuestionController extends Zend_Controller_Action
{
	public function indexAction()
	{
		$service = new QuestionService();
		if ($this->getRequest()->isPost ()) {
			if(!$service->store())
			{
				$this->view->question = $_POST;
			}
		}
		
		$data = $service->getPublish();
		
		$gui = $this->_helper->getHelper("Gui");
		$gui->showData($data,5);
	}

	public function viewAction()
	{
		$service = new QuestionService();
		$id = $this->_getParam("id");
		if(!empty($id))
		{
			$this->view->question = $service->loadData($id);
		}
	}

}